"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UString = exports.Utils = void 0;
/**
 * @ Author: Yoann Meclot. MSay2
 * @ Created on: 2020-08-29 07:11:08
 * @ Modified on: 2020-09-27 01:54:12
 *
 * @version 1.2
 */
/**
 * Copyright (c) 2020 MSay2, Yoann Meclot - Utils.ts
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Exceptions_1 = require("./Exceptions");
/**
 * The Utils class is a utiliy
 *
 * @class Utils
 * @version 1.2
 * @since 1.0
 */
class Utils {
    /**
     * Check if the reference is null.
     *
     * If the refence is null the NullPointerException is invoked.
     *
     * @param reference The reference object.
     * @param message The message.
     * @type {boolean}
     * @since 1.0
     */
    static checkNotNull(reference, message) {
        if (reference == null) {
            throw new Exceptions_1.NullPointerException(message);
        }
        else {
            return reference;
        }
    }
}
exports.Utils = Utils;
/**
 * The UString class is a utiliy for String argument
 *
 * @class UString
 * @version 1.4
 * @since 1.0
 */
class UString {
    /**
     * Check if the value is a String type
     *
     * @param value value to check
     * @returns return true if the value is a String type
     * @type {boolean}
     * @since 1.0
     */
    static isEmpty(value) {
        return value == null || value.trim().length == 0;
    }
    /**
     * Check if the argument contain the specified value
     *
     * @param arg the argument to verify
     * @param value the value to check
     * @returns return true is the argument contain the specified value
     * @type {boolean}
     * @since 1.4
     */
    static contains(arg, value) {
        return arg.indexOf(value) >= 0;
    }
    /**
     * Remove the last char of your value String
     *
     * @param value value to change
     * @returns return the value changed
     * @type {string}
     * @since 1.2
     */
    static removeLastChar(value) {
        let result = null;
        if ((value != null) && (value.length > 0)) {
            result = value.substring(0, value.length - 1);
        }
        return result;
    }
}
exports.UString = UString;
//# sourceMappingURL=Utils.js.map